﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Collections.ObjectModel;

namespace navigation.Data
{
    public class Task : INotifyPropertyChanged
    {
        private string taskName;
        private string storyName;
        private string taskContent;
        private string taskCardColor;
        private string owner;
        private int progress;
        private bool canDrop = false;
        private string state;
        private string isTaskCardEditable = "False";

        public string TaskName
        {
            get { return taskName; }
            set 
            { 
                taskName = value;
                SendPropertyChanged("taskName");
            }
        }

        public string StoryName
        {
            get { return storyName; }
            set 
            { 
                storyName = value;
                SendPropertyChanged("storyName");
            }
        }

        public string TaskContent
        {
            get { return taskContent; }
            set 
            { 
                taskContent = value;
                SendPropertyChanged("taskContent");
            }
        }

        public string TaskCardColor
        {
            get { return taskCardColor; }
            set { taskCardColor = value; }
        }

        public string Owner
        {
            get { return owner; }
            set 
            { 
                owner = value;
                SendPropertyChanged("owner");
            }
        }

        public int Progress
        {
            get { return progress; }
            set 
            { 
                progress = value;
                SendPropertyChanged("progress");
            }
        }

        public object DraggedElement
        {
            get;
            set;
        }        

        public bool CanDrop
        {
            set { canDrop = value; }
            get { return canDrop; }
        }

        public string State
        {
            set { state = value; }
            get { return state; }
        }

        public string IsTaskCardEditable
        {
            set 
            { 
                isTaskCardEditable = value;
                SendPropertyChanged("isTaskCardEditable");
            }
            get { return isTaskCardEditable; }
        }

        private void SendPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = this.PropertyChanged;
            if (handler != null)
            {
                var e = new PropertyChangedEventArgs(propertyName);
                this.PropertyChanged(this, e);
            }
        }

        # region Constructors

        public event PropertyChangedEventHandler PropertyChanged;

        public Task(string taskName, string taskContent)
        {
            this.taskName = taskName;
            this.taskContent = taskContent;
        }       

        //public Task(string taskName, string taskContent, string taskCardColor)
        //{
        //    this.taskName = taskName;
        //    this.taskContent = taskContent;
        //    this.taskCardColor = taskCardColor;
        //}

        public Task(string taskName, string storyName, string taskContent, string state)
        {
            this.taskName = taskName;
            this.storyName = storyName;
            this.taskContent = taskContent;
            this.state = state;
        }

        #endregion
    }
}
